package com.newsmanagement.dao;

import com.newsmanagement.entity.NewsContentEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;
import java.util.Map;

/**
 * @author xbr
 * 2017/12/5
 * 社会动态评论操作
 */
@Mapper
public interface ISocialDevelopmentServiceContentDao {

    /**
     * 发布动态评论（即保存动态评论）
     * @param createUser 操作的用户id
     * @param developmentId 动态id
     * @param contentTxt 评论内容
     * @return 添加的数据条数
     */
    @Insert("INSERT INTO social_development_comment_t (" +
            "DEVELOPMENT_ID ,COMMENT_TXT ,CREATE_USER ,CREATE_DATE" +
            ") VALUES (" +
            "#{arg1} ,#{arg2} ,#{arg0} ,NOW()" +
            ")")
    int releaseContent(Integer createUser, Integer developmentId, String contentTxt);

    /**
     * 查询动态下的所有评论信息
     * @param developmentId 动态id
     * @return List<Map<String ,Object>>
     */
    @Select("SELECT * FROM social_development_comment_t WHERE DEVELOPMENT_ID = #{arg0} AND DELETE_FLAG = 1")
    List<Map<String ,Object>> allCommentByDevelopmentIdList(Integer developmentId);


}
